package com.quectel.core.module.device.dto;

import com.quectel.core.module.alarm.dto.AlarmRuleDto;
import com.quectel.core.module.application.dto.ApplicationDto;
import com.quectel.core.module.village.dto.VillageBuildingDto;
import com.quectel.core.module.village.dto.VillageDto;
import com.quectel.core.module.village.dto.VillageFloorDto;
import com.quectel.core.module.village.dto.VillageRoomDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 设备
 *
 * @author rananxin
 * @email: ryan.ran@quectel.com
 * @date 2021-10-29 13:49:59
 */
@Data
@Schema
public class DeviceDto implements Serializable {

    /**
     *
     */
    @Schema(description = "")
    private Long id;

    /**
     * 父级id
     */
    @Schema(description = "父级id")
    private Long parentId;

    /**
     * 租户id
     */
    @Schema(description = "租户id")
    private Long tenantId;

    /**
     * 设备种类id
     */
    @Schema(description = "设备种类id")
    @NotNull
    private Long deviceCategoryId;

    /**
     * 设备类型id
     */
    @Schema(description = "设备类型id")
    @NotNull
    private Long deviceTypeId;

    /**
     * 所属小区id
     */
    @Schema(description = "所属小区id")
    @NotNull
    private Long villageId;

    /**
     * 应用id
     */
    @Schema(description = "应用id")
    private Long applicationId;

    /**
     * 安装楼栋
     */
    @Schema(description = "安装楼栋")
    private Long buildingId;

    /**
     * 安装楼层
     */
    @Schema(description = "安装楼层")
    private Long floorId;

    /**
     * 安装房间
     */
    @Schema(description = "安装房间")
    private Long roomId;

    /**
     * 设别码
     */
    @Schema(description = "设别码")
    @NotBlank
    @Length(min = 1, max = 50)
    private String uniqueId;

    /**
     * IMEI
     */
    @Schema(description = "IMEI")
    @NotBlank
    @Length(min = 1, max = 50)
    private String imei;

    /**
     * ip
     */
    @Schema(description = "ip")
    private String ip;

    /**
     * 自定义名称
     */
    @Schema(description = "自定义名称")
    @NotBlank
    @Length(min = 1, max = 80)
    private String name;

    /**
     * 原始名称
     */
    @Schema(description = "原始名称")
    private String originName;

    /**
     * 纬度
     */
    @Schema(description = "纬度")
    private Double latitude;

    /**
     * 经度
     */
    @Schema(description = "经度")
    private Double longitude;

    /**
     * 信号类型
     */
    @Schema(description = "信号类型")
    private Byte signalType;

    /**
     * 电源类型
     */
    @Schema(description = "电源类型")
    private Byte powerType;

    /**
     * 硬件版本
     */
    @Schema(description = "硬件版本")
    private String hardVersion;

    /**
     * 软件版本
     */
    @Schema(description = "软件版本")
    private String softVersion;

    /**
     * 最近一次心跳
     */
    @Schema(description = "最近一次心跳")
    private Date lastHeartbeat;

    /**
     * 最近一次物模型数据详情
     */
    @Schema(description = "最近一次物模型数据详情")
    private String lastData;

    /**
     * 扩展字段
     */
    @Schema(description = "扩展字段")
    private String extraAttr;

    /**
     * 1在线0离线
     */
    @Schema(description = "1在线0离线")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte onlineStatus;

    /**
     * 1告警0正常
     */
    @Schema(description = "1告警0正常")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte alarmStatus;

    /**
     * 告警开关 1开启0关闭
     */
    @Schema(description = "告警开关 1开启0关闭")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte alarmSwitch;

    /**
     * 事件开关1开启0关闭
     */
    @Schema(description = "事件开关1开启0关闭")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte eventSwitch;

    /**
     * 工单开关1开启0关闭
     */
    @Schema(description = "工单开关1开启0关闭")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte workOrderSwitch;


    /**
     * 是否自定义告警规则
     */
    @Schema(description = "是否自定义告警规则")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte customRule;

    @Schema(description = "安装状态")
    private Byte installStatus;

    @Schema(description = "安装位置")
    private String installAddress;

    @Schema(description = "安装时间")
    private Date installTime;

    /**
     * 生产日期
     */
    @Schema(description = "生产日期")
    private Date manufactureTime;

    /**
     *
     */
    @Schema(description = "")
    private String creator;

    /**
     *
     */
    @Schema(description = "")
    private Date createTime;

    /**
     *
     */
    @Schema(description = "")
    private String editor;

    /**
     *
     */
    @Schema(description = "")
    private Date editTime;

    /************非数据库字段 start ************/

    @Schema(description = "设备类型信息")
    private DeviceTypeDto deviceType;

    @Schema(description = "设备种类信息")
    private DeviceCategoryDto deviceCategory;

    @Schema(description = "设备社区信息")
    private VillageDto village;

    @Schema(description = "所在楼栋")
    private VillageBuildingDto building;

    @Schema(description = "所在层数")
    private VillageFloorDto floor;

    @Schema(description = "所在房间")
    private VillageRoomDto room;

    @Schema(description = "应用信息")
    private ApplicationDto application;

    @Schema(description = "类型名称")
    private String deviceTypeName;

    @Schema(description = "自定义告警规则")
    List<AlarmRuleDto> ruleList;
    /************非数据库字段 end **************/
}
